//package com.hspedu.furns.web;
//
//import com.hspedu.furns.service.MemberService;
//import com.hspedu.furns.service.impl.MemberServiceImpl;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * @author 徐
// * @version 1.0
// */
//public class LoginServlet extends HttpServlet {
//    //定义一个service属性
//    private MemberService memberService = new MemberServiceImpl();
//
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        //System.out.println("LoginServlet被调用...");
//        //老韩说明:如果在登录页面, 用户没有输入内容，就直接提交，后台接收到的是""
//        String username = request.getParameter("username");
//        String password = request.getParameter("password");
//        //调用memberService判断
//        if (memberService.loginMember(username, password)) {
//            //System.out.println("登陆成功");
//            //登陆成功，跳转页面
//            request.getRequestDispatcher("/views/member/login_ok.jsp")
//                    .forward(request,response);
//        }else {
//            //System.out.println("登陆失败");
//            request.setAttribute("msg","用户名或密码错误");
//            request.setAttribute("username",username);
//            request.getRequestDispatcher("/views/member/login.jsp")
//                    .forward(request,response);
//
//        }
//
//    }
//
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        doPost(request,response);
//    }
//}
